import api from '@/common/js/api.js'
const configInfo = uni.getStorageSync("configInfo") || {}
let state = {
		globalConfig:configInfo, //配置信息
	},
	getters = {},
	mutations = {
		setGlobalConfig(state, configData){
			state.globalConfig = configData
			if(configData.site_title){
				document.querySelector("title").innerText = configData.site_title
			}
			// 本地缓存配置信息
			uni.setStorageSync("configInfo", configData)
		}
	},
	actions = {
		//获取配置信息
		async geConfigInfo({commit}){
			let res = await api.getConfigInfo()
			console.log("配置i细腻",res)
			if(res.code === 200 && res.data){
				// commit("setGlobalConfig", res.data)
			}else{
				
			}
		}
	}
export default {
	namespaced: true,
	state,
	getters,
	mutations,
	actions
}
